package com.songlanyun.common.drive;

import cn.hutool.extra.cglib.CglibUtil;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;

import java.math.BigDecimal;

@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
public abstract class RootEntity<T, E extends RootEntity> {
    /**
     * 获得当前实例的标识（id）
     *
     * @return
     */
    @JsonIgnore
    public abstract T getIdentity();


    /**
     * 判断两个实体对象是否相等
     *
     * @return
     */

    public boolean equals(E target) {
        return this.getIdentity().equals(target.getIdentity());
    }

    @JsonIgnore
    public boolean isEmpty() {
        return this.getIdentity() == null;
    }
}
